package com.lhd.shop.controller;

import bo.KeepOrderDetailsBO;
import com.lhd.shop.service.FrontService;
import dto.OrderDTO;
import dto.OrderDetailsDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vo.ResponseData;

import java.util.List;

/**
 * @program: sporadic
 * @description:
 * @author: LHD   QQ:1727865856
 * @create: 2019-11-20 13:46
 **/
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private FrontService frontService;

    @PostMapping("/add")
    public ResponseData<Void> addOrder(@RequestBody OrderDTO orderDTO){
        return frontService.add(orderDTO);
    }

    @PostMapping("/updateOrder")
    public ResponseData<Void> keepOrderDetails(@RequestBody KeepOrderDetailsBO keepOrderDetailsBO){
        return frontService.keepOrderDetails(keepOrderDetailsBO);
    }

    @GetMapping("/queryBymidAllorder")
    public ResponseData<List<OrderDTO>> queryBymidAllorder(Integer mid){
        return frontService.queryBymidAllorder(mid);
    }

    @GetMapping("/queryDetails")
    public ResponseData<List<OrderDetailsDTO>> querydetails(String orderNo){
        return frontService.queryall(orderNo);
    }

    @GetMapping("/queryByidOrder")
    public ResponseData<OrderDTO> queryByidOrder(String orderId){
        return frontService.queryByid(orderId);
    }

}
